package com.wuhan.template.module.wode.activity;

import android.content.Intent;
import android.graphics.Color;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;

import com.wuhan.template.R;
import com.wuhan.template.base.BaseActivity;
import com.wuhan.template.base.BaseFragment;
import com.wuhan.template.module.home.activity.MainActivity;
import com.wuhan.template.module.wode.adapter.CollectPageAdapter;
import com.wuhan.template.module.wode.fragment.PictureCollectFragment;
import com.wuhan.template.module.wode.fragment.VideoCollectFragment;
import com.wuhan.template.module.wode.fragment.WordCollectFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by Administrator on 2016/5/14 0014.
 */
public class MyCollectActivity extends BaseActivity{

    @BindView(R.id.collect_Tablayout)
    protected TabLayout tabLayout;

    @BindView(R.id.collect_viewPage)
    protected ViewPager viewPager;

    @BindView(R.id.collect_back)
    protected ImageView imageView;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_collect;
    }

    private List<Fragment> fragments = new ArrayList<>();
    @Override
    protected void initViews() {
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MyCollectActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        });
        WordCollectFragment fragment1 = BaseFragment.newInstance(WordCollectFragment.class,null);
        fragments.add(fragment1);
        PictureCollectFragment fragment2 = BaseFragment.newInstance(PictureCollectFragment.class,null);
        fragments.add(fragment2);
        VideoCollectFragment fragment3 = BaseFragment.newInstance(VideoCollectFragment.class,null);
        fragments.add(fragment3);

        CollectPageAdapter pageAdapter = new CollectPageAdapter(getSupportFragmentManager(),this,fragments);
        viewPager.setAdapter(pageAdapter);

        tabLayout.setSelectedTabIndicatorColor(Color.BLUE);
        tabLayout.setTabMode(TabLayout.MODE_FIXED);
        tabLayout.setupWithViewPager(viewPager);
    }

    @Override
    protected void loadData() {

    }

}
